const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.code 索赔单编号(索赔单号)
 * @param {} options.dealerId 服务站Id
 * @param {} options.brandId 品牌Id
 * @param {} options.causePartCode 主损件编号
 * @param {} options.causePartName 主损件名称
 * @param {} options.vin VIN
 * @param {} options.status 状态  1-未汇总  2-已汇总
 * @param {} options.repairType 状态  1-车辆索赔  2-备件索赔  3-PDI索赔  4-售前索赔
 * @throws {Error}
 * @return {Promise}
 */
router.get('/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        dealerId: req.query.dealerId,
        brandId: req.query.brandId,
        causePartCode: req.query.causePartCode,
        causePartName: req.query.causePartName,
        vin: req.query.vin,
        status: req.query.status,
        repairType: req.query.repairType
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id52',
                    code: 'code53',
                    dealerCode: 'dealerCode54',
                    dealerName: 'dealerName55',
                    brandCode: 'brandCode56',
                    causePartCode: 'causePartCode57',
                    causePartName: 'causePartName58',
                    vin: 'vin',
                    productCategoryCode: 'productCategoryCode59',
                    status: 1,
                    repairType: 1,
                    totalFee: 1,
                    rowVersion: 'rowVersion',
                    options: [
                        'update'
                    ]
                },
                {
                    id: 'id60',
                    code: 'code61',
                    dealerCode: 'dealerCode62',
                    dealerName: 'dealerName63',
                    brandCode: 'brandCode64',
                    causePartCode: 'causePartCode65',
                    causePartName: 'causePartName66',
                    vin: 'vin',
                    productCategoryCode: 'productCategoryCode67',
                    status: 1,
                    repairType: 1,
                    totalFee: 1,
                    rowVersion: 'rowVersion',
                    options: [
                        'update'
                    ]
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
router.get('/forUpdate', async(req, res, next) => {
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id52',
                    code: 'code53',
                    causePartCode: 'causePartCode57',
                    causePartName: 'causePartName58',
                    vin: 'vin',
                    productCategoryCode: 'productCategoryCode59',
                    faultType: 1,
                    faultModeName: 'faultModeName',
                    faultItemName: 'faultItemName',
                    isKd: 'yes'
                },
                {
                    id: 'id60',
                    code: 'code61',
                    causePartCode: 'causePartCode65',
                    causePartName: 'causePartName66',
                    vin: 'vin',
                    productCategoryCode: 'productCategoryCode67',
                    faultType: 1,
                    faultModeName: 'faultModeName',
                    faultItemName: 'faultItemName',
                    isKd: 'yes'
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});

router.get('/forUpdate/details', async(req, res, next) => {
    const data = {
        message: 'message',
        payload: {
            repairType: 1,
            faultModeCode: 'faultModeCode77',
            faultModeName: 'faultModeName78',
            supplierId: 'supplierId79',
            supplierCode: 'supplierCode80',
            supplierName: 'supplierName81',
            repairDate: '2019-09-20T09:05:28Z',
            secondClaims: [
                {
                    id: 'id1',
                    rowVersion: 'rowVersion1',
                },
                {
                    id: 'id2',
                    rowVersion: 'rowVersion2',
                }
            ],
            details: [
                {
                    isCaused: true,
                    isDecimalAllowed: true,
                    usedPartId: 'usedPartId91',
                    usedPartCode: 'usedPartCode92',
                    usedPartName: 'usedPartName93',
                    newPartId: 'newPartId94',
                    newPartCode: 'newPartCode95',
                    newPartName: 'newPartName96',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                }
            ],
            accessoryDetails: [
                {
                    usedPartId: 'usedPartId97',
                    isDecimalAllowed: true,
                    usedPartCode: 'usedPartCode98',
                    usedPartName: 'usedPartName99',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                },
                {
                    usedPartId: 'usedPartId100',
                    isDecimalAllowed: true,
                    usedPartCode: 'usedPartCode101',
                    usedPartName: 'usedPartName102',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id68',
            code: 'code69',
            claimApplyCode: 'claimApplyCode70',
            brandId: 'brandId71',
            brandCode: 'brandCode72',
            subDealerId: 'subDealerId73',
            subDealerCode: 'subDealerCode74',
            subDealerName: 'subDealerName75',
            subClaimCode: 'subClaimCode76',
            currency: 1,
            repairType: 1,
            faultModeCode: 'faultModeCode77',
            faultModeName: 'faultModeName78',
            faultDescription: 'faultDescription',
            isOut: true,
            outFee: 1,
            supplierId: 'supplierId79',
            supplierCode: 'supplierCode80',
            supplierName: 'supplierName81',
            partPurchasedDate: '2019-09-20T09:05:28Z',
            repairCode: 'repairCode82',
            repairDate: '2019-09-20T09:05:28Z',
            vin: 'vin',
            mileage: 1,
            engineCode: 'engineCode83',
            customerName: 'customerName84',
            cellPhoneNumber: 'cellPhoneNumber',
            saleDate: '2019-09-20T09:05:28Z',
            shippingDate: '2019-09-20T09:05:28Z',
            rowVersion: 'rowVersion',
            options: [
                'update'
            ],
            details: [
                {
                    isCaused: false,
                    isDecimalAllowed: true,
                    usedPartId: 'usedPartId85',
                    usedPartCode: 'usedPartCode86',
                    usedPartName: 'usedPartName87',
                    newPartId: 'newPartId88',
                    newPartCode: 'newPartCode89',
                    newPartName: 'newPartName90',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                },
                {
                    isCaused: true,
                    isDecimalAllowed: true,
                    usedPartId: 'usedPartId91',
                    usedPartCode: 'usedPartCode92',
                    usedPartName: 'usedPartName93',
                    newPartId: 'newPartId94',
                    newPartCode: 'newPartCode95',
                    newPartName: 'newPartName96',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                }
            ],
            accessoryDetails: [
                {
                    usedPartId: 'usedPartId97',
                    isDecimalAllowed: true,
                    usedPartCode: 'usedPartCode98',
                    usedPartName: 'usedPartName99',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                },
                {
                    usedPartId: 'usedPartId100',
                    isDecimalAllowed: true,
                    usedPartCode: 'usedPartCode101',
                    usedPartName: 'usedPartName102',
                    usedPartDealCategory: 1,
                    unit: 'unit',
                    quantity: 1,
                    price: 1,
                    materialFee: 1
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
module.exports = router;
